#ifndef CONNECTWIDGET_H
#define CONNECTWIDGET_H

#include <QWidget>
#include <QHostAddress>
#include <QTcpSocket>
#include <QPushButton>
#include <QLabel>
#include <QLineEdit>
#include <QVBoxLayout>
#include <QMessageBox>

#include "Network.h"
#include "GuiParameters.h"

class ConnectWidget : public QWidget {

    Q_OBJECT

public:
    explicit ConnectWidget(QWidget *parent = 0, Network::ConnectionStatus * status = 0);
    ~ConnectWidget();

    QTcpSocket * clientSocket;

signals:
    void connectionStatusChanged(Network::ConnectionStatus status);

public slots:
    void changeConnectionStatus(Network::ConnectionStatus status);

private slots:
    void connectOnClick();
    void clientNewConnection();
    void socketDisconnect();
    void connectionError(QAbstractSocket::SocketError socketError);

private:
    void createWidgets();
    void createLayouts();
    void connectSignalSlots();

    Network::ConnectionStatus * connectionStatus;

    QLabel * hostAddressLabel;
    QLineEdit * hostAddressEdit;
    QPushButton * connectButton;
};

#endif // CONNECTWIDGET_H
